package model;

import java.util.Date;
import java.util.Observable;

import dao.Schedule;
import dao.Customer;

public class ModelSchedule extends Observable{
	private Schedule schedule = new Schedule();
				
	public void update(Schedule schedule){
		if(schedule != null){
			this.setOID(schedule.getOID());
			this.setDeService(schedule.getDeService());			 
			this.setDhStart(schedule.getDhStart());
			this.setDhEnd(schedule.getDhEnd());
			this.setIdFit(schedule.getIdFit());	
			this.setCustomer(schedule.getCustomer());
			
			setChanged();
			notifyObservers();
		}
	}
	
	public Schedule getSchedule() {
		return schedule;
	}
		
	public int getOID() {
		return schedule.getOID();
	}
	public void setOID(int oID) {
		schedule.setOID(oID);
	}
	public String getDeService() {
		return schedule.getDeService();
	}

	public void setDeService(String deService) {
		schedule.setDeService(deService);
	}

	public Date getDhStart() {
		return schedule.getDhStart();
	}

	public void setDhStart(Date dhStart) {
		schedule.setDhStart(dhStart);
	}

	public Date getDhEnd() {
		return schedule.getDhEnd();
	}

	public void setDhEnd(Date dhEnd) {
		schedule.setDhEnd(dhEnd);
	}

	public Customer getCustomer() {
		return schedule.getCustomer();
	}

	public void setCustomer(Customer customer) {
		schedule.setCustomer(customer);
		setChanged();
		notifyObservers();
	}
	
	public String getIdFit() {
		return schedule.getIdFit();
	}
	public void setIdFit(String idFit) {
		schedule.setIdFit(idFit);
	}
	
	public String toString(){
		return schedule.getDhStart() + " - " + schedule.getCustomer().getNmCustomer();
	}	
}
